/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * DatosEcocardiogramaPanel.java
 *
 * Created on 17/01/2011, 17:22:06
 */

package presentacion.examen;

import hibernate.objeto.HolterEstudioCardiologia;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import javax.swing.JDialog;
import javax.swing.JSpinner.DefaultEditor;
import logica.CapaLogica;
import logica.validacion.CapaValidacion;
import presentacion.CapaPresentacion;
import presentacion.utilidad.maquetado.Fuente;
import presentacion.utilidad.maquetado.InformeError;

/**
 *
 * @author Gonzalo
 */
public class DatosHolterPanel extends javax.swing.JPanel {

    /** Creates new form DatosEcocardiogramaPanel */
    public DatosHolterPanel() {
        initComponents();
        setearEventosQueCapturanTeclaEnterYEscape();
    }

    /**
     * Setea datos de la ventana.
     *
     */
    public void personalizarJDialog(HolterEstudioCardiologia 
            holterEstudioCardiologia) {
        this.holterEstudioCardiologia =
                holterEstudioCardiologia;
        exhibirDatosEnPantalla();
        if(CapaPresentacion.modoVisualizacion) {
            inhabilitarCampos();
        }
    }

    /**
     * Permite visualizar los detalles de la evolución.
     *
     */
    private void exhibirDatosEnPantalla() {
        if (holterEstudioCardiologia.
                getDuracionEnHorasHolterEstudioCardiologia().
                equalsIgnoreCase("24")) {
            veinticuatroDuracionEnHorasHolter.setSelected(true);
            cuarentayochoDuracionEnHorasHolter.setSelected(false);
        } else {
            veinticuatroDuracionEnHorasHolter.setSelected(false);
            cuarentayochoDuracionEnHorasHolter.setSelected(true);
        }
        if (holterEstudioCardiologia.
                getEsSvHolterEstudioCardiologia().equalsIgnoreCase("si")) {
            siEsSVHolter.setSelected(true);
            noEsSVHolter.setSelected(false);
        } else {
            siEsSVHolter.setSelected(false);
            noEsSVHolter.setSelected(true);
        }
        if (holterEstudioCardiologia.
                getEsVHolterEstudioCardiologia().
                equalsIgnoreCase("si")) {
            siEsVHolter.setSelected(true);
            noEsVHolter.setSelected(false);
        } else {
            siEsVHolter.setSelected(false);
            noEsVHolter.setSelected(true);
        }
        fCMaximoHolter.setValue(holterEstudioCardiologia.
                getFcMaximoHolterEstudioCardiologia());
        fCMinimoHolter.setValue(holterEstudioCardiologia.
                getFcMinimoHolterEstudioCardiologia());
        fCPromedioHolter.setValue(holterEstudioCardiologia.
                getFcPromedioHolterEstudioCardiologia());
        trastornoDelSTHolter.setText(holterEstudioCardiologia.
                getTrastornoDelStHolterEstudioCardiologia());
        trastornoDelSTHolter.setCaretPosition(0);
        conclusionesHolter.setText(holterEstudioCardiologia.
                getConclusionesHolterEstudioCardiologia());
        conclusionesHolter.setCaretPosition(0);
    }

    /**
     * Pone en false la propiedad enabled de todos los campos de ingreso.
     *
     */
    private void inhabilitarCampos() {
        veinticuatroDuracionEnHorasHolter.setEnabled(false);
        cuarentayochoDuracionEnHorasHolter.setEnabled(false);
        siEsSVHolter.setEnabled(false);
        noEsSVHolter.setEnabled(false);
        siEsVHolter.setEnabled(false);
        noEsVHolter.setEnabled(false);
        fCMaximoHolter.setEnabled(false);
        fCMinimoHolter.setEnabled(false);
        fCPromedioHolter.setEnabled(false);
        trastornoDelSTHolter.setEnabled(false);
        conclusionesHolter.setEnabled(false);
    }

    /**
     * Valida en conjunto todos los campos. Aquellos que son obligatorios y los
     * que no.
     *
     * @return true si el objeto está listo para cargarse, false en caso
     * contrario
     */
    public boolean validarCampos() {
        boolean esDuracionEnHorasValida = validarCamposDuracionEnHoras();
        boolean esSVValida = validarCamposSV();
        boolean esVValida = validarCamposV();
        boolean esTrastornoDelSTValida = validarCampoTrastornoDelST();

        return esDuracionEnHorasValida && esSVValida 
                && esVValida && esTrastornoDelSTValida;
    }

    /**
     * Valida los campos correspondiente al campo Duracion en horas.
     *
     * @return true si los campos estan listos para cargarse, false en caso
     * contrario
     */
    private boolean validarCamposDuracionEnHoras() {
        boolean retorno;

        if (!veinticuatroDuracionEnHorasHolter.isSelected() &&
                !cuarentayochoDuracionEnHorasHolter.isSelected()) {
            textoDuracionEnHorasHolter.setForeground(
                    Fuente.COLOR_ERROR);
            textoDuracionEnHorasHolter.setToolTipText(
                    InformeError.
                    INFORME_ERROR_CARDIOLOGICO_HOLTER_DURACION_EN_HORAS);
            retorno = false;
        } else {
            textoDuracionEnHorasHolter.setForeground(Fuente.COLOR_NORMAL);
            textoDuracionEnHorasHolter.setToolTipText(null);
            retorno = true;
        }

        return retorno;
    }
    /**
     * Valida los campos correspondiente al campo SV.
     *
     * @return true si los campos estan listos para cargarse, false en caso
     * contrario
     */
    private boolean validarCamposSV() {
        boolean retorno;

        if (!siEsSVHolter.isSelected() &&
                !noEsSVHolter.isSelected()) {
            textoEsSVHolter.setForeground(
                    Fuente.COLOR_ERROR);
            textoEsSVHolter.setToolTipText(
                    InformeError.
                    INFORME_ERROR_CARDIOLOGICO_HOLTER_ES_SV);
            retorno = false;
        } else {
            textoEsSVHolter.setForeground(Fuente.COLOR_NORMAL);
            textoEsSVHolter.setToolTipText(null);
            retorno = true;
        }

        return retorno;
    }

    /**
     * Valida los campos correspondiente al campo V.
     *
     * @return true si los campos estan listos para cargarse, false en caso
     * contrario
     */
    private boolean validarCamposV() {
        boolean retorno;

        if (!siEsVHolter.isSelected() &&
                !noEsVHolter.isSelected()) {
            textoEsVHolter.setForeground(
                    Fuente.COLOR_ERROR);
            textoEsVHolter.setToolTipText(
                    InformeError.
                    INFORME_ERROR_CARDIOLOGICO_HOLTER_ES_SV);
            retorno = false;
        } else {
            textoEsVHolter.setForeground(Fuente.COLOR_NORMAL);
            textoEsVHolter.setToolTipText(null);
            retorno = true;
        }

        return retorno;
    }

    /**
     * Valida los campos correspondiente al campo Trastorno Del ST.
     *
     * @return true si los campos estan listos para cargarse, false en caso
     * contrario
     */
    private boolean validarCampoTrastornoDelST() {
        boolean retorno;

        if (!CapaValidacion.validarCampoObligatorio(trastornoDelSTHolter.
                getText())) {
            textoTrastornoDelSTHolter.setForeground(
                    Fuente.COLOR_ERROR);
            textoTrastornoDelSTHolter.setToolTipText(
                    InformeError.
                    INFORME_ERROR_CARDIOLOGICO_CINECORONOARIOGRAFIA_VENTRICULAR_IZQUIERDA);
            retorno = false;
        } else {
            textoTrastornoDelSTHolter.setForeground(Fuente.COLOR_NORMAL);
            textoTrastornoDelSTHolter.setToolTipText(null);
            retorno = true;
        }

        return retorno;
    }
    
    /**
     * Recopila los datos del panel para colocarlos dentro del arreglo.
     *
     * @param datosEstudioCardiologia El arreglo a cargar
     */
    public void recopilarDatos(Object[] datosEstudioCardiologia) {

        if (veinticuatroDuracionEnHorasHolter.isSelected()) {
            datosEstudioCardiologia[CapaLogica.ESTUDIO_CARDIOLOGIA_HOLTER_DURACION_EN_HORAS] =
                "24";
        } else {
            datosEstudioCardiologia[CapaLogica.ESTUDIO_CARDIOLOGIA_HOLTER_DURACION_EN_HORAS] =
                "48";
        }
        if (siEsSVHolter.isSelected()) {
            datosEstudioCardiologia[CapaLogica.ESTUDIO_CARDIOLOGIA_HOLTER_ES_SV] =
                "si";
        } else {
            datosEstudioCardiologia[CapaLogica.ESTUDIO_CARDIOLOGIA_HOLTER_ES_SV] =
                "no";
        }
        if (siEsVHolter.isSelected()) {
            datosEstudioCardiologia[CapaLogica.ESTUDIO_CARDIOLOGIA_HOLTER_ES_V] =
                "si";
        } else {
            datosEstudioCardiologia[CapaLogica.ESTUDIO_CARDIOLOGIA_HOLTER_ES_V] =
                "no";
        }
        datosEstudioCardiologia[CapaLogica.
                ESTUDIO_CARDIOLOGIA_HOLTER_FC_MAXIMO] =
                fCMaximoHolter.getValue();
        datosEstudioCardiologia[CapaLogica.
                ESTUDIO_CARDIOLOGIA_HOLTER_FC_MINIMO] =
                fCMinimoHolter.getValue();
        datosEstudioCardiologia[CapaLogica.ESTUDIO_CARDIOLOGIA_HOLTER_FC_PROMEDIO] =
                fCPromedioHolter.getValue();
        datosEstudioCardiologia[CapaLogica.ESTUDIO_CARDIOLOGIA_HOLTER_TRASTORNO_DEL_ST] =
                trastornoDelSTHolter.getText();
        datosEstudioCardiologia[CapaLogica.ESTUDIO_CARDIOLOGIA_HOLTER_CONCLUSIONES] =
                conclusionesHolter.getText();

    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        valvulasEcocardiograma1 = new javax.swing.JTextField();
        textoDuracionEnHorasHolter = new javax.swing.JLabel();
        textoFCPromedioHolter = new javax.swing.JLabel();
        fCPromedioHolter = new javax.swing.JSpinner();
        fCMinimoHolter = new javax.swing.JSpinner();
        textoFCMaximoHolter = new javax.swing.JLabel();
        fCMaximoHolter = new javax.swing.JSpinner();
        textoFCMinimoHolter = new javax.swing.JLabel();
        textoEsSVHolter = new javax.swing.JLabel();
        textoEsVHolter = new javax.swing.JLabel();
        textoTrastornoDelSTHolter = new javax.swing.JLabel();
        trastornoDelSTHolter = new javax.swing.JTextField();
        siEsSVHolter = new javax.swing.JRadioButton();
        noEsSVHolter = new javax.swing.JRadioButton();
        siEsVHolter = new javax.swing.JRadioButton();
        noEsVHolter = new javax.swing.JRadioButton();
        conclusionesScrollPane1 = new javax.swing.JScrollPane();
        conclusionesHolter = new javax.swing.JTextArea();
        textoConclusionesHolter = new javax.swing.JLabel();
        veinticuatroDuracionEnHorasHolter = new javax.swing.JRadioButton();
        cuarentayochoDuracionEnHorasHolter = new javax.swing.JRadioButton();

        valvulasEcocardiograma1.setPreferredSize(new java.awt.Dimension(78, 20));

        textoDuracionEnHorasHolter.setFont(Fuente.FUENTE_TEXTFIELD);
        textoDuracionEnHorasHolter.setText("Duración en horas");
        textoDuracionEnHorasHolter.setPreferredSize(new java.awt.Dimension(233, 20));

        textoFCPromedioHolter.setFont(Fuente.FUENTE_TEXTFIELD);
        textoFCPromedioHolter.setText("FC promedio");
        textoFCPromedioHolter.setPreferredSize(new java.awt.Dimension(233, 20));

        fCPromedioHolter.setFont(Fuente.FUENTE_TEXTFIELD);
        fCPromedioHolter.setModel(new javax.swing.SpinnerNumberModel());
        fCPromedioHolter.setPreferredSize(new java.awt.Dimension(70, 20));

        fCMinimoHolter.setFont(Fuente.FUENTE_TEXTFIELD);
        fCMinimoHolter.setModel(new javax.swing.SpinnerNumberModel());
        fCMinimoHolter.setPreferredSize(new java.awt.Dimension(70, 20));

        textoFCMaximoHolter.setFont(Fuente.FUENTE_TEXTFIELD);
        textoFCMaximoHolter.setText("FC máximo");
        textoFCMaximoHolter.setPreferredSize(new java.awt.Dimension(233, 20));

        fCMaximoHolter.setFont(Fuente.FUENTE_TEXTFIELD);
        fCMaximoHolter.setModel(new javax.swing.SpinnerNumberModel());
        fCMaximoHolter.setPreferredSize(new java.awt.Dimension(70, 20));

        textoFCMinimoHolter.setFont(Fuente.FUENTE_TEXTFIELD);
        textoFCMinimoHolter.setText("FC mínimo");
        textoFCMinimoHolter.setPreferredSize(new java.awt.Dimension(233, 20));

        textoEsSVHolter.setFont(Fuente.FUENTE_TEXTFIELD);
        textoEsSVHolter.setText("Es SV");
        textoEsSVHolter.setPreferredSize(new java.awt.Dimension(233, 20));

        textoEsVHolter.setFont(Fuente.FUENTE_TEXTFIELD);
        textoEsVHolter.setText("Es V");
        textoEsVHolter.setPreferredSize(new java.awt.Dimension(233, 20));

        textoTrastornoDelSTHolter.setFont(Fuente.FUENTE_TEXTFIELD);
        textoTrastornoDelSTHolter.setText("Trastorno del ST");
        textoTrastornoDelSTHolter.setPreferredSize(new java.awt.Dimension(233, 20));

        trastornoDelSTHolter.setFont(Fuente.FUENTE_TEXTFIELD);
        trastornoDelSTHolter.setPreferredSize(new java.awt.Dimension(70, 20));

        siEsSVHolter.setFont(Fuente.FUENTE_CHECKBOX);
        siEsSVHolter.setForeground(Fuente.COLOR_NORMAL);
        siEsSVHolter.setText("si");
        siEsSVHolter.setPreferredSize(new java.awt.Dimension(35, 20));
        siEsSVHolter.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                siEsSVHolterActionPerformed(evt);
            }
        });

        noEsSVHolter.setFont(Fuente.FUENTE_CHECKBOX);
        noEsSVHolter.setForeground(Fuente.COLOR_NORMAL);
        noEsSVHolter.setText("no");
        noEsSVHolter.setPreferredSize(new java.awt.Dimension(38, 20));
        noEsSVHolter.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                noEsSVHolterActionPerformed(evt);
            }
        });

        siEsVHolter.setFont(Fuente.FUENTE_CHECKBOX);
        siEsVHolter.setForeground(Fuente.COLOR_NORMAL);
        siEsVHolter.setText("si");
        siEsVHolter.setPreferredSize(new java.awt.Dimension(55, 20));
        siEsVHolter.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                siEsVHolterActionPerformed(evt);
            }
        });

        noEsVHolter.setFont(Fuente.FUENTE_CHECKBOX);
        noEsVHolter.setForeground(Fuente.COLOR_NORMAL);
        noEsVHolter.setText("no");
        noEsVHolter.setPreferredSize(new java.awt.Dimension(55, 20));
        noEsVHolter.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                noEsVHolterActionPerformed(evt);
            }
        });

        conclusionesScrollPane1.setPreferredSize(new java.awt.Dimension(248, 80));

        conclusionesHolter.setColumns(20);
        conclusionesHolter.setFont(Fuente.FUENTE_TEXTFIELD);
        conclusionesHolter.setRows(4);
        conclusionesScrollPane1.setViewportView(conclusionesHolter);

        textoConclusionesHolter.setFont(Fuente.FUENTE_TEXTFIELD);
        textoConclusionesHolter.setText("Conclusiones");
        textoConclusionesHolter.setPreferredSize(new java.awt.Dimension(102, 20));

        veinticuatroDuracionEnHorasHolter.setFont(Fuente.FUENTE_CHECKBOX);
        veinticuatroDuracionEnHorasHolter.setForeground(Fuente.COLOR_NORMAL);
        veinticuatroDuracionEnHorasHolter.setText("24");
        veinticuatroDuracionEnHorasHolter.setPreferredSize(new java.awt.Dimension(42, 20));
        veinticuatroDuracionEnHorasHolter.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                veinticuatroDuracionEnHorasHolterActionPerformed(evt);
            }
        });

        cuarentayochoDuracionEnHorasHolter.setFont(Fuente.FUENTE_CHECKBOX);
        cuarentayochoDuracionEnHorasHolter.setForeground(Fuente.COLOR_NORMAL);
        cuarentayochoDuracionEnHorasHolter.setText("48");
        cuarentayochoDuracionEnHorasHolter.setPreferredSize(new java.awt.Dimension(42, 20));
        cuarentayochoDuracionEnHorasHolter.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cuarentayochoDuracionEnHorasHolterActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(textoConclusionesHolter, 0, 0, Short.MAX_VALUE)
                    .addComponent(textoTrastornoDelSTHolter, 0, 0, Short.MAX_VALUE)
                    .addComponent(textoEsVHolter, 0, 0, Short.MAX_VALUE)
                    .addComponent(textoEsSVHolter, 0, 0, Short.MAX_VALUE)
                    .addComponent(textoFCMinimoHolter, javax.swing.GroupLayout.DEFAULT_SIZE, 90, Short.MAX_VALUE)
                    .addComponent(textoFCMaximoHolter, javax.swing.GroupLayout.DEFAULT_SIZE, 90, Short.MAX_VALUE)
                    .addComponent(textoFCPromedioHolter, javax.swing.GroupLayout.DEFAULT_SIZE, 90, Short.MAX_VALUE)
                    .addComponent(textoDuracionEnHorasHolter, javax.swing.GroupLayout.DEFAULT_SIZE, 90, Short.MAX_VALUE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(veinticuatroDuracionEnHorasHolter, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(cuarentayochoDuracionEnHorasHolter, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(fCMaximoHolter, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(fCPromedioHolter, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                        .addComponent(fCMinimoHolter, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                .addComponent(siEsVHolter, javax.swing.GroupLayout.Alignment.LEADING, 0, 0, Short.MAX_VALUE)
                                .addComponent(siEsSVHolter, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addComponent(noEsVHolter, javax.swing.GroupLayout.DEFAULT_SIZE, 38, Short.MAX_VALUE)
                                .addComponent(noEsSVHolter, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
                    .addComponent(trastornoDelSTHolter, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(conclusionesScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(44, 44, 44))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(textoDuracionEnHorasHolter, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(veinticuatroDuracionEnHorasHolter, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(cuarentayochoDuracionEnHorasHolter, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(textoFCPromedioHolter, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(fCPromedioHolter, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(textoFCMaximoHolter, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(fCMaximoHolter, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(textoFCMinimoHolter, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(fCMinimoHolter, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(textoEsSVHolter, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(siEsSVHolter, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(noEsSVHolter, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(textoEsVHolter, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(siEsVHolter, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(noEsVHolter, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(textoTrastornoDelSTHolter, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(trastornoDelSTHolter, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(textoConclusionesHolter, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(conclusionesScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
    }// </editor-fold>//GEN-END:initComponents

    private void veinticuatroDuracionEnHorasHolterActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_veinticuatroDuracionEnHorasHolterActionPerformed
        if (veinticuatroDuracionEnHorasHolter.isSelected()) {
            cuarentayochoDuracionEnHorasHolter.setSelected(false);
        }
    }//GEN-LAST:event_veinticuatroDuracionEnHorasHolterActionPerformed

    private void cuarentayochoDuracionEnHorasHolterActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cuarentayochoDuracionEnHorasHolterActionPerformed
        if (cuarentayochoDuracionEnHorasHolter.isSelected()) {
            veinticuatroDuracionEnHorasHolter.setSelected(false);
        }
    }//GEN-LAST:event_cuarentayochoDuracionEnHorasHolterActionPerformed

    private void siEsSVHolterActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_siEsSVHolterActionPerformed
        if (siEsSVHolter.isSelected()) {
            noEsSVHolter.setSelected(false);
        }
    }//GEN-LAST:event_siEsSVHolterActionPerformed

    private void noEsSVHolterActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_noEsSVHolterActionPerformed
        if (noEsSVHolter.isSelected()) {
            siEsSVHolter.setSelected(false);
        }
    }//GEN-LAST:event_noEsSVHolterActionPerformed

    private void siEsVHolterActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_siEsVHolterActionPerformed
        if (siEsVHolter.isSelected()) {
            noEsVHolter.setSelected(false);
        }
    }//GEN-LAST:event_siEsVHolterActionPerformed

    private void noEsVHolterActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_noEsVHolterActionPerformed
        if (noEsVHolter.isSelected()) {
            siEsVHolter.setSelected(false);
        }
    }//GEN-LAST:event_noEsVHolterActionPerformed

    /**
     * Setea en cada componente del JDialog los eventos que capturarán la tecla
     * enter y escape.
     */
    private void setearEventosQueCapturanTeclaEnterYEscape() {
        //Declaración del evento a capturar
        KeyListener keyListenerEscape = new KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                if (evt.getKeyCode() == KeyEvent.VK_ESCAPE) {
                    cerrarVentana();
                }
            }
        };

        //Setear eventos
        veinticuatroDuracionEnHorasHolter.addKeyListener(keyListenerEscape);
        cuarentayochoDuracionEnHorasHolter.addKeyListener(keyListenerEscape);
        ((DefaultEditor) fCMaximoHolter.getEditor()).
                getTextField().addKeyListener(keyListenerEscape);
        ((DefaultEditor) fCMinimoHolter.getEditor()).
                getTextField().addKeyListener(keyListenerEscape);
        ((DefaultEditor) fCPromedioHolter.getEditor()).
                getTextField().addKeyListener(keyListenerEscape);
        siEsSVHolter.addKeyListener(keyListenerEscape);
        noEsSVHolter.addKeyListener(keyListenerEscape);
        siEsVHolter.addKeyListener(keyListenerEscape);
        siEsVHolter.addKeyListener(keyListenerEscape);
        trastornoDelSTHolter.addKeyListener(keyListenerEscape);
        conclusionesHolter.addKeyListener(keyListenerEscape);
    }

    private void cerrarVentana() {
        JDialog jdialog = (JDialog)
                this.getParent().getParent().getParent().getParent().
                getParent().getParent().getParent().getParent().
                getParent().getParent().getParent().getParent().getParent();
        jdialog.dispose();
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JTextArea conclusionesHolter;
    private javax.swing.JScrollPane conclusionesScrollPane1;
    private javax.swing.JRadioButton cuarentayochoDuracionEnHorasHolter;
    private javax.swing.JSpinner fCMaximoHolter;
    private javax.swing.JSpinner fCMinimoHolter;
    private javax.swing.JSpinner fCPromedioHolter;
    private javax.swing.JRadioButton noEsSVHolter;
    private javax.swing.JRadioButton noEsVHolter;
    private javax.swing.JRadioButton siEsSVHolter;
    private javax.swing.JRadioButton siEsVHolter;
    private javax.swing.JLabel textoConclusionesHolter;
    private javax.swing.JLabel textoDuracionEnHorasHolter;
    private javax.swing.JLabel textoEsSVHolter;
    private javax.swing.JLabel textoEsVHolter;
    private javax.swing.JLabel textoFCMaximoHolter;
    private javax.swing.JLabel textoFCMinimoHolter;
    private javax.swing.JLabel textoFCPromedioHolter;
    private javax.swing.JLabel textoTrastornoDelSTHolter;
    private javax.swing.JTextField trastornoDelSTHolter;
    private javax.swing.JTextField valvulasEcocardiograma1;
    private javax.swing.JRadioButton veinticuatroDuracionEnHorasHolter;
    // End of variables declaration//GEN-END:variables
    private HolterEstudioCardiologia holterEstudioCardiologia;
}
